<!--conf
<sample>
              <product version="1.2" edition="std"/>
                     <modifications>
                            <modified date="070101"/>
                     </modifications>
               </sample>
 --> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>Autosize</title>
	<script>
		window.dhx_globalImgPath="../../codebase/imgs/";
	</script>
	<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxcombo.css">
	
	<script  src="../../codebase/dhtmlxcommon.js"></script>
	<script  src="../../codebase/dhtmlxcombo.js"></script>
	<script src="../../codebase/ext/dhtmlxcombo_whp.js" type="text/javascript"></script>
</head>
  

<body>
<link rel='STYLESHEET' type='text/css' href='../common/style.css'>
<table cellspacing="0" cellpadding="0" class="sample_header" border="0">
	<tr valign="middle">
		<!-- COMPONENT ICON -->
		<td width="40" align="center"><img src="../common/dhtmlxcombo_icon.gif" border="0"></td>
		<!-- COMPONENT NAME -->
		<td width="150" align="left" nowrap="true">Sample: dhtmlxCombo</td>
		<!-- SAMPLE TITLE -->
		<td width="0" align="left" nowrap><b>Autosize</b></td>
		<!-- LINK TO COMPONENT PAGE -->
		<td width="0" align="right"><a href="http://www.dhtmlx.com/docs/products/dhtmlxCombo/index.shtml">dhtmlxCombo main page</a></td>
		<!-- CLOSE BUTTON -->
		<td width="50"><div class="sample_close"><a href="javascript:void(0);" onclick="self.close();"><img src="../common/sample_close.gif" width="14" height="14" border="0" alt="X"></a></div></td>
	</tr>
</table>
<p>There is an opportunity to set automatic width and height for the list of combo options. <br/>In this case, the size of combo list adjusts to its content.</p>

<table>
	<tr>
		<td><div id="combo_zone2" style="width:200px; height:30px;"></div></td> <td style="padding-left:40px" align="left">Size: <a href="javascript:void(0)" onclick="z.setOptionWidth(document.getElementById('width1').value)">width</a> <input type="text" id="width1" value="200" size="3"> , <a href="javascript:void(0)" onclick="z.setOptionHeight(document.getElementById('height1').value)">height</a> <input type="text" id="height1" value="200" size="3"></td>
	</tr>
	<tr>
		<td></td>
		<td align="left" style="padding-left:40px" >
		
		<a href="javascript:void(0)" onclick="z.enableOptionAutoHeight(1)">enable</a> / <a href="javascript:void(0)" onclick="z.enableOptionAutoHeight(0)">disable</a> Auto <b>Height</b><br/>
		
		<a href="javascript:void(0)" onclick="z.enableOptionAutoWidth(1)">enable</a> / <a href="javascript:void(0)" onclick="z.enableOptionAutoWidth(0)">disable</a> Auto <b>Width</b><br/>
		</td>
	</tr>
</table>
	
	<script>
	
        var z=new dhtmlXCombo("combo_zone2","alfa2",200);
		
        z.loadXML("data_a.xml");
		
		z.enableOptionAutoPositioning();

</script>
<div class='sample_code'><div class="hl-main"><pre><span class="hl-code"> 
</span><span class="hl-identifier">z</span><span class="hl-code">.</span><span class="hl-identifier">setOptionWidth</span><span class="hl-brackets">(</span><span class="hl-number">200</span><span class="hl-brackets">)</span><span class="hl-code">;        </span><span class="hl-comment">//</span><span class="hl-comment"> sets combo width</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-identifier">z</span><span class="hl-code">.</span><span class="hl-identifier">setOptionHeight</span><span class="hl-brackets">(</span><span class="hl-number">200</span><span class="hl-brackets">)</span><span class="hl-code">;       </span><span class="hl-comment">//</span><span class="hl-comment"> sets combo height</span><span class="hl-comment"></span><span class="hl-code">
 
</span><span class="hl-identifier">z</span><span class="hl-code">.</span><span class="hl-identifier">enableOptionAutoHeight</span><span class="hl-brackets">(</span><span class="hl-number">1</span><span class="hl-brackets">)</span><span class="hl-code">;  </span><span class="hl-comment">//</span><span class="hl-comment"> enables auto height of combo options</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-identifier">z</span><span class="hl-code">.</span><span class="hl-identifier">enableOptionAutoHeight</span><span class="hl-brackets">(</span><span class="hl-number">0</span><span class="hl-brackets">)</span><span class="hl-code">;  </span><span class="hl-comment">//</span><span class="hl-comment"> disables auto height of combo options</span><span class="hl-comment"></span><span class="hl-code">
 
</span><span class="hl-identifier">z</span><span class="hl-code">.</span><span class="hl-identifier">enableOptionAutoWidth</span><span class="hl-brackets">(</span><span class="hl-number">1</span><span class="hl-brackets">)</span><span class="hl-code">;   </span><span class="hl-comment">//</span><span class="hl-comment"> enables auto width of combo options </span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-identifier">z</span><span class="hl-code">.</span><span class="hl-identifier">enableOptionAutoWidth</span><span class="hl-brackets">(</span><span class="hl-number">0</span><span class="hl-brackets">)</span><span class="hl-code">;   </span><span class="hl-comment">//</span><span class="hl-comment"> disables auto width of combo options</span><span class="hl-comment"></span></pre></div></div>


<!-- FOOTER -->
<table callspacing="0" cellpadding="0" border="0" class="sample_footer"><tr><td style="padding-left: 8px;">&copy; <a href="http://www.dhtmlx.com">DHTMLX LTD</a>. All rights reserved</td></tr></table>
<!-- FOOTER -->

</body>
</html>
